//
//  MSStarControl.h
//  testMasory
//
//  Created by xiangbo on 2018/9/21.
//  Copyright © 2018年 xiangbo. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class MSStarControl;
@protocol MSStarControlDelegate <NSObject>
@optional

// 星星百分比（得分值）发生变化的代理
- (void)starControl:(MSStarControl *)starControl scorePercentDidChange:(CGFloat)newScorePercent;
@end

@interface MSStarControl : UIView

@property (nonatomic, assign) CGFloat scorePercent;//得分值
@property (nonatomic, assign) BOOL hasAnimation;//是否允许动画，默认为NO
@property (nonatomic, assign) BOOL allowIncompleteStar;//评分时是否允许不是整星，默认为NO
@property (nonatomic, assign) BOOL allowScore;//是否允许评分 默认NO

@property (nonatomic, weak) id<MSStarControlDelegate>delegate;

/**
 星星

 @param frame 控件大小
 @param numberOfStars 星星个数
 @param foreColor 上层色
 @param backColor 底色
 @return instancetype
 */
- (instancetype)initWithFrame:(CGRect)frame
                numberOfStars:(NSInteger)numberOfStars
                    foreColor:(nullable UIColor *)foreColor
                    backColor:(nullable UIColor *)backColor;

- (instancetype)initWithFrame:(CGRect)frame
                numberOfStars:(NSInteger)numberOfStars
                        image:(nullable NSString *)imageName
                    foreColor:(nullable UIColor *)foreColor
                    backColor:(nullable UIColor *)backColor;

@end

NS_ASSUME_NONNULL_END
